<template>
	<van-row class="logininput">
		<van-row>
			<input type="text" placeholder="请输入账号" class="phonelogininput" ref="username">
		</van-row>
		<van-row>
			<input type="password" placeholder="请输入密码" class="phonelogininput">
		</van-row>
		<van-row>
			<button @click="login" class="logininputbutton">登录</button>
		</van-row>
	</van-row>
</template>

<script>
	export default
	{
		data()
		{
			return{
				user:{}
			}
		},
		created()
		{
			
		},
		methods:
		{
			login()
			{
				let telphone=this.$refs.username.value
				
				let data=
				{
					phone:telphone
				}
				
				this.$nextTick(function()
				{
					this.$store.dispatch("picture/vuexLogin",data)
					.then((e=>
					{
						this.user=e.data.data
						console.log(this.user)
						if(this.user==null)
						{
							alert('登录失败用户名不存在')
						}
						else
						{
							localStorage.setItem('username',JSON.stringify(this.user))
							this.$router.push('/mine')
						}
					}))
				})
			}
		}
	}
</script>

<style>
</style>
